package net.homeftp.heimo.camera;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.Log;
import android.view.SurfaceView;

public class DrawView extends SurfaceView {
	private final String TAG = "DrawView";
	private int displayColor;
	public int midX;
	public int midY;
	
	public DrawView(Context context) {
		super(context);
		setWillNotDraw(false);

	}

	@Override
	protected void onDraw(Canvas c) {
		fnDrawCrossLines(c);
		fnDrawSquare(c);

		// A Simple Text Render to test the display
//		c.drawText("Hello World!", 50, 50, p);
//		Paint p = new Paint(Color.RED);
//		c.drawText("TARGET", c.getWidth() / 2,c.getHeight() / 2, p);
	}

	private void fnDrawCrossLines(Canvas c) {
		Paint p = new Paint();
		p.setColor(Color.BLACK);
		midX = (c.getWidth() / 2);
		midY = (c.getHeight() / 2);
		
		c.drawLine(0, midY, c.getWidth(), midY, p);
        c.drawLine(midX, 0, midX, c.getHeight(), p);
	}
	
	private void fnDrawSquare(Canvas c) {
		midX = (c.getWidth() / 2);
		midY = (c.getHeight() / 2);
		
		Paint p = new Paint();
        p.setColor(Color.WHITE);
        p.setStrokeWidth(20);
        c.drawRect(midX/4, midY/4, midX/2, midY/2, p);
	}

	public void setDisplayColor(int color) {
		this.displayColor = color;
		Log.i(TAG, "Display Color : "+color);
	}

}